package p.ithorns.framework.xxljob;

import com.xxl.job.core.biz.AdminBiz;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;

import java.util.List;

/**
 * ExtXxlJobSpringExecutor
 *
 * @author Ht.L
 * @date 2024-02-29 19:06
 * @since 1.0.0
 */
public class ExtXxlJobSpringExecutor extends XxlJobSpringExecutor {

    private final AdminBiz client;

    public ExtXxlJobSpringExecutor(AdminBiz client) {
        this.client = client;
    }

    @Override
    public void afterSingletonsInstantiated() {
        super.afterSingletonsInstantiated();
        addAdminBiz(client);
    }

    private void addAdminBiz(AdminBiz client) {
        List<AdminBiz> adminBizList = getAdminBizList();
        assert null != adminBizList;
        adminBizList.clear();
        adminBizList.add(client);
    }

}